# -*- mode: python ; coding: utf-8 -*-

# 最优化版spec文件，用于最大程度减小PyInstaller打包后的文件大小

block_cipher = None

a = Analysis(
    ['H:\\MY\\python\\wpython\\top\\wardyan\\projects\\checktool\\autokill\\sticklistmain.py'],
    pathex=["H:\\MY\\python\\wpython\\", "H:\\MY\\python\\wpython\\.venv\\Lib\\site-packages\\"],
    binaries=[],
    datas=[],
    hiddenimports=[
        # 仅包含项目实际使用的模块
        "apscheduler.schedulers.background",
        "apscheduler.schedulers",
        "apscheduler",
        "loguru",
        "pymssql",
        "PyMySQL",
        "requests",
        "requests_toolbelt",
        "httpcore",
        "httpx",
        "uuid",
        # PySide6核心模块（只包含实际使用的模块）
        "PySide6.QtCore",
        "PySide6.QtGui",
        "PySide6.QtWidgets",
        # 项目内部模块
        "top.wardyan.core.action.baseaction",
        "top.wardyan.core.vo.vos",
        "top.wardyan.core.widges.tables",
        "top.wardyan.projects.checktool.autokill.sticklistwindow",
        "config",
    ],
    hookspath=[],
    hooksconfig={},
    runtime_hooks=[],
    excludes=[
        # 排除大量不必要的模块以减小文件大小
        "tkinter",
        "unittest",
        "email",
        "http.server",
        "xmlrpc",
        "pydoc",
        "doctest",
        "argparse",
        "difflib",
        "inspect",
        "multiprocessing",
        "concurrent",
        "html",
        "json",
        "xml",
        "urllib",
        "http",
        "ftplib",
        "pickle",
        "zipfile",
        "tarfile",
        "gzip",
        "bz2",
        "lzma",
        "sqlite3",
        "ssl",
        "socket",
        "asyncio",
        "selectors",
        "signal",
        "threading",
        "distutils",
        "ensurepip",
        "msilib",
        "modulefinder",
        "netrc",
        "nntplib",
        "optparse",
        "pdb",
        "poplib",
        "smtplib",
        "telnetlib",
        "uuid",
        "webbrowser",
        "wsgiref",
        "xxlimited",
        "zipapp",
        # 排除大型库
        "numpy",
        "pandas",
        "matplotlib",
        "scipy",
        "sklearn",
        "PIL",
        "cv2",
        "tensorflow",
        "torch",
        "jupyter",
        "notebook",
        "IPython",
        "pygments",
        "nbconvert",
        "nbformat",
        "ipykernel",
        "ipywidgets",
        "bokeh",
        "plotly",
        "seaborn",
        "flask",
        "django",
        "fastapi",
        "uvicorn",
        "starlette",
        "sqlalchemy",
        "pymongo",
        "redis",
        "celery",
        "kafka",
        "rabbitmq",
        "elasticsearch",
        "beautifulsoup4",
        "lxml",
        "selenium",
        "pytest",
        "coverage",
        "tox",
        "twisted",
        "tornado",
        "paramiko",
        "cryptography",
        "bcrypt",
        "cffi",
        "pycparser",
        "pillow",
        "opencv-python",
        "scrapy",
        "dash",
        "dash_core_components",
        "dash_html_components",
        "dash_table",
    ],
    win_no_prefer_redirects=False,
    win_private_assemblies=False,
    cipher=block_cipher,
    noarchive=False,
)

# 优化PYZ（Python字节码存档）
pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)

exe = EXE(
    pyz,
    a.scripts,
    a.binaries,
    a.datas,
    [],
    name='sticklistmain_optimized',
    debug=False,
    bootloader_ignore_signals=False,
    strip=True,  # 启用strip选项
    upx=True,  # 启用UPX压缩
    upx_exclude=[],
    runtime_tmpdir=None,
    console=False,  # GUI应用
    disable_windowed_traceback=True,  # 禁用回溯
    argv_emulation=False,
    target_arch=None,
    codesign_identity=None,
    entitlements_file=None,
    icon='umbrella.ico',
    version="file_verison_info.txt"
)